<?php

// 返回搜索内容
$json = array('status' => 'error', 'msg' => 'error', 'data' => []);

$tit = fn_post('tit');

$p = fn_post('p', 1);
$p = is_numeric($p) ? $p : 1;

if (!$tit) {
	$json['msg'] = '查询不能为空!';
} else {

	$json['status'] = 'ok';
	$json['msg'] = 'ok';
	$json['data'] = $this->website['class']['db']
		->table('movies')
		->field('id', 'tit', 'isMovie', 'releasetime', 'score', 'lang', 'image')
		->where('tit like ?', '%' . $tit . '%')
		->order('id desc')
		->page($p)
		->num(10)
		->paging();
}
// $json['sql'] = $this->website['class']['db']->sql;
foreach ($json['data']['data'] as &$v) {
	$v['actor'] = $this->website['class']['db']
		->table('movie_actor')
		->field('actor')
		->where('movieid=?', $v['id'])
		->select();
}

$this->json_encode_encrypt($json);
